package com.cskaoyan.market.util.wx;

import com.cskaoyan.market.vo.wx.lhh.HandleOptionVo;

/**
 * @ClassName HandleOptionUtil
 * @Description
 * @Author MZ
 * @Date 2023/5/20 11:20
 */
public class HandleOptionUtil {

    /**
     * @MethodName getHandleOption
     * @Description  传入状态码，获取HandleOptionVo对象
     * @param: orderStatus
     * @return: com.cskaoyan.market.vo.lhh.HandleOptionVo
     * @Author MZ
     * @Date 11:21 2023/5/20
     **/
    public static HandleOptionVo getHandleOption(Short orderStatus) {
        HandleOptionVo handleOption = new HandleOptionVo();
        if (orderStatus == 201){
            // 已付款
            handleOption.setRefund(true);
        }
        if (orderStatus == 101){
            // 未付款
            handleOption.setCancel(true);
            handleOption.setPay(true);
        }
        if (orderStatus == 301){
            // 已发货
            handleOption.setConfirm(true);
        }
        if (orderStatus == 401 || orderStatus == 402){
            // 已收货
            handleOption.setDelete(true);
            handleOption.setComment(true);
            handleOption.setRebuy(true);
            handleOption.setAftersale(true);
        }
        return handleOption;
    }

    public static String convertStatusText(Short orderStatus) {
        switch (orderStatus) {
            case 101:
                return "未付款";
            case 102:
                return "用户取消";
            case 103:
                return "系统取消";
            case 201:
                return "已付款";
            case 202:
                return "订单取消,退款中";
            case 203:
                return "已退款";
            case 301:
                return "已发货";
            case 401:
                return "待评价";
            case 402:
                return "待评价";
            default:
                return "未知状态";
        }
    }
}
